import javax.swing.text.Style;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Gao zhao xu
 * Date: 2023-11-27
 * Time: 9:41
 */
class Student {
    //私有属性name
    private String name = "bit";
    //公有属性age
    public int age = 18;

    //不带参数的构造方法
    public Student() {
        System.out.println("Student()");
    }

    private Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("Student(String,name)");
    }

    private void eat() {
        System.out.println("i am eat");
    }

    public void sleep() {
        System.out.println("i am pig");
    }

    private void function(String str) {
        System.out.println(str);
    }

    @
            Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

public class Test {
    public static void main(String[] args) throws ClassNotFoundException{
        Student s1 = new Student();
        /**
         * 三种方式获取的class对象
         * 一个类只有一个class对象，所以三个class是一样的
         */
        Class<?> c1 = s1.getClass();
        Class<?> c2 = Student.class;
        Class<?> c3 = Class.forName("Student");
        System.out.println(c1);
        System.out.println(c2);
        System.out.println(c3);
        //Class.forName("demo.Student")
    }
}
